package com.combetter.changxing.ui.dialog;

import android.app.Dialog;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.TextView;

import com.combetter.changxing.R;


/**
 * Created by cxb on 2017/4/13.
 */

public class LoadingDialog extends RxDialog {

    private String mMsg = "";
    private TextView title;
    public LoadingDialog(Context context, int themeResId) {
        super(context, themeResId);
        initView();
    }

    public LoadingDialog(Context context, boolean cancelable, OnCancelListener cancelListener) {
        super(context, cancelable, cancelListener);
        initView();
    }

    public LoadingDialog(Context context) {
        super(context);
        initView();
    }

    public LoadingDialog(Context context, float alpha, int gravity) {
        super(context, alpha, gravity);
        initView();
    }

    public static LoadingDialog getInstance(Context activity) {
        return new LoadingDialog(activity);
    }

    public void setMsg(String msg) {
        title.setText(msg);
    }

    private void initView() {
        View dialogView = LayoutInflater.from(getContext()).inflate(R.layout.dialog_loading, null);
        title = dialogView.findViewById(R.id.id_dialog_loading_msg);
        Dialog dialog = new Dialog(getContext(), R.style.dialog);
        dialog.setCanceledOnTouchOutside(false);
        setContentView(dialogView);
    }


}
